home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Atari Compendium
/
The Atari Compendium (Toad Computers) (1994).iso
/
files
/
prgtools
/
programm.ing
/
dlibsrc.arc
/
CATCH.C
< prev
next >
Encoding:
Amiga
Atari
Commodore
DOS
FM Towns/JPY
Macintosh
Macintosh JP
Macintosh to JP
NeXTSTEP
RISC OS/Acorn
Shift JIS
UTF-8
Wrap
C/C++ Source or Header
|
1988-10-04
|
382 b
|
19 lines
#include <setjmp.h>
static int _catchval; /* catch/throw return value */
int catch(id, fn) /* execute fn() within a catch frame */
register jmp_buf *id;
register int (*fn)();
{
return(setjmp(id) ? _catchval : ((*fn)()));
}
throw(id, rv) /* return rv to the id catch */
register jmp_buf *id;
register int rv;
{
_catchval = rv;
longjmp(id, 1);
}